﻿using System;
using System.Collections.Generic;
using netDxf;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Tables;

namespace TestDxfDocument.model
{
    public class TangMingCheng
    {
        public static void Figure29014_70_A1(Dictionary<string, Object> data) //ISO 13399-70图片A.1
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan }; //轮廓层
            Layer dimensioning = new Layer("dimensioning"); //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red }; //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow }; //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue }; //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue }; //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan }; //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red }; //切削层
            Layer nocutting = new Layer("nocutting"); //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning"); //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red }; //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue }; //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue }; //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan }; //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan }; //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning"); //skview尺寸线层
            //作图
            //参数
            double r = 13.5;
            double r1 = 30;
            double f = 1;
            double pi = Math.PI;
            double par = 28 * pi / 180;
            string path = Convert.ToString(data["path"]);
            //主视图
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X, v1.Y + r - r / 5);
            Vector2 v3 = new Vector2(v2.X, v1.Y - r + r / 5);
            //
            Vector2 v4 = new Vector2(v2.X + r * 2 / 5, v1.Y + r);
            Vector2 v5 = new Vector2(v3.X + r * 2 / 5, v1.Y - r);
            //
            Vector2 v6 = new Vector2(v2.X, v2.Y + r1 - r);
            Vector2 v7 = new Vector2(v3.X, v3.Y - r1 + r);
            Vector2 v8 = new Vector2(v2.X + r * 2.6 / 5, v2.Y);
            Vector2 v9 = new Vector2(v3.X + r * 2.6 / 5, v3.Y);
            Vector2 v10 = new Vector2(v8.X + f, v8.Y - f / 2 / Math.Tan(par));
            Vector2 v11 = new Vector2(v9.X + f, v9.Y + f / 2 / Math.Tan(par));
            Vector2 v12 = new Vector2(v6.X + f * 2 - f / 3, v6.Y + f / Math.Tan(par));
            Vector2 v13 = new Vector2(v7.X + f * 2, v7.Y - f / Math.Tan(par));
            Vector2 v15 = new Vector2(v12.X + r1, v12.Y + f * 2);
            Vector2 v16 = new Vector2(v13.X + r1, v13.Y - f * 2);
            Vector2 v17 = new Vector2(v15.X + f + f / 2, v15.Y);
            Vector2 v18 = new Vector2(v16.X + f + f / 2, v16.Y);
            Vector2 v19 = new Vector2(v17.X, v17.Y + f * 8.6);
            Vector2 v20 = new Vector2(v18.X, v18.Y - f * 8.6);
            Vector2 v21 = new Vector2(v19.X + r - f * 3, v19.Y);
            Vector2 v22 = new Vector2(v20.X + r - f * 3, v20.Y);
            //
            Vector2 v23 = new Vector2(v21.X - f * 2, v1.Y + f * 4.6);
            Vector2 v24 = new Vector2(v21.X - f * 2, v1.Y);
            Vector2 v25 = new Vector2(v21.X - f * 2, v1.Y - f * 4.6);
            Vector2 v26 = new Vector2(v23.X + f * 6.4, v23.Y);
            Vector2 v27 = new Vector2(v25.X + f * 6.4, v25.Y);
            //
            Vector2 v28 = new Vector2(v21.X + f, v21.Y - f * 2);
            Vector2 v29 = new Vector2(v21.X, v23.Y);
            Vector2 v30 = new Vector2(v28.X, v23.Y);
            Vector2 v31 = new Vector2(v21.X + f / 2, v21.Y - f);
            Vector2 v32 = new Vector2(v21.X + f / 2, v23.Y);
            //
            Vector2 v34 = new Vector2(v28.X + f, v28.Y);
            Vector2 v35 = new Vector2(v34.X + f, v21.Y);
            Vector2 v36 = new Vector2(v35.X + f + f * 2 / 5, v35.Y);
            Vector2 v37 = new Vector2(v36.X, v23.Y);
            Vector2 v38 = new Vector2(v34.X, v23.Y);
            Vector2 v39 = new Vector2(v35.X, v23.Y);
            Vector2 v40 = new Vector2(v34.X + f / 2, v21.Y - f);
            Vector2 v41 = new Vector2(v40.X, v23.Y);
            //
            Vector2 v42 = new Vector2(v1.X + f / 1.6, v1.Y + r - r / 5);
            Vector2 v43 = new Vector2(v42.X, v2.Y + r - r / 6);
            Vector2 v44 = new Vector2(v1.X, v43.Y + f + f / 5);
            Vector2 v45 = new Vector2(v43.X + r1 / 3, v43.Y);
            Vector2 v46 = new Vector2(v45.X + f * 1.6, v45.Y + f * 3);
            Vector2 v47 = new Vector2(v46.X + r1 / 2 + f * 2, v46.Y);
            Vector2 v48 = new Vector2(v47.X + f * 4, v43.Y);
            Vector2 v49 = new Vector2(v48.X + f * 6.2, v48.Y);
            Vector2 v50 = new Vector2(v49.X + f, v49.Y - f);
            //
            Vector2 v51 = new Vector2(v42.X, v1.Y - r + r / 5);
            Vector2 v52 = new Vector2(v51.X, v51.Y - r + r / 6);
            Vector2 v53 = new Vector2(v1.X, v52.Y - f + f / 5);
            Vector2 v54 = new Vector2(v52.X + r1 / 3, v52.Y);
            //
            Vector2 v55 = new Vector2(v54.X + f * 1.6, v54.Y - f * 3);
            //
            Vector2 v56 = new Vector2(v55.X + r1 / 2 + f * 2, v55.Y);
            Vector2 v57 = new Vector2(v56.X + f * 4, v52.Y);
            Vector2 v58 = new Vector2(v57.X + f * 6.2, v57.Y);
            Vector2 v59 = new Vector2(v58.X + f, v58.Y + f);
            //
            Vector2 v60 = new Vector2(v55.X + r, v1.Y);
            Vector2 v61 = new Vector2(v55.X + r + f * 2.5, v1.Y + f * 2.8);
            Vector2 v62 = new Vector2(v23.X, v1.Y + f * 2.8);
            Vector2 v63 = new Vector2(v61.X, v1.Y - f * 2.8);
            Vector2 v64 = new Vector2(v23.X, v1.Y - f * 2.8);
            Vector2 v65 = new Vector2(v63.X, v64.Y + f * 1.5);
            Vector2 v66 = new Vector2(v61.X, v62.Y - f * 1.5);
            //
            Vector2 v67 = new Vector2(v22.X + f, v22.Y + f * 2);
            Vector2 v68 = new Vector2(v22.X, v25.Y);
            Vector2 v69 = new Vector2(v67.X, v25.Y);
            Vector2 v70 = new Vector2(v67.X + f, v67.Y);
            Vector2 v71 = new Vector2(v70.X + f, v22.Y);
            Vector2 v72 = new Vector2(v71.X + f + f * 1 / 8, v71.Y);
            Vector2 v73 = new Vector2(v71.X, v25.Y);
            Vector2 v74 = new Vector2(v70.X, v25.Y);
            Vector2 v75 = new Vector2(v72.X, v25.Y);
            Vector2 v76 = new Vector2(v72.X, v72.Y + r1 / 3 - f * 3);
            Vector2 v77 = new Vector2(v76.X + f + f * 4 / 5, v76.Y + f + f * 4 / 5);
            //
            Vector2 v78 = new Vector2(v36.X, v36.Y - r1 / 3 + f * 3);
            Vector2 v79 = new Vector2(v78.X + f + f * 4 / 5, v78.Y - f - f * 4 / 5);
            //
            Vector2 v80 = new Vector2(v77.X + r1 - r1 / 8, v77.Y);
            Vector2 v81 = new Vector2(v79.X + r1 - r1 / 8, v79.Y);
            Vector2 v82 = new Vector2(v80.X, v80.Y - f * 2);
            Vector2 v83 = new Vector2(v81.X, v81.Y + f * 2);
            Vector2 v84 = new Vector2(v82.X + r1 / 3 + f * 3.6, v80.Y - f * 2);
            Vector2 v85 = new Vector2(v83.X + r1 / 3 + f * 3.6, v81.Y + f * 2);
            //
            Vector2 v92 = new Vector2(v85.X, v85.Y - f / 2);
            Vector2 v86 = new Vector2(v85.X + r1 / 3 - f * 3, v92.Y);
            Vector2 v87 = new Vector2(v85.X + r1 / 3 - f * 3, v85.Y - r);
            Vector2 v88 = new Vector2(v85.X, v85.Y - r);
            //
            Vector2 v93 = new Vector2(v84.X, v84.Y + f / 2);
            Vector2 v89 = new Vector2(v84.X + r1 / 3 - f * 3, v93.Y);
            Vector2 v90 = new Vector2(v84.X + r1 / 3 - f * 3, v84.Y + r);
            Vector2 v91 = new Vector2(v84.X, v84.Y + r);
            //Vector2 v92 = new Vector2(v85.X,v85.Y-f/2);
            //Vector2 v93 = new Vector2(v84.X, v84.Y + f / 2);
            Vector2 v94 = new Vector2(v88.X, v88.Y - f * 2);
            Vector2 v95 = new Vector2(v94.X + r1 / 1.6 + f * 8, v94.Y);
            Vector2 v96 = new Vector2(v91.X, v91.Y + f * 2);
            Vector2 v97 = new Vector2(v96.X + r1 / 1.6 + f * 8, v96.Y);
            //
            Vector2 v98 = new Vector2(v95.X, v95.Y - f * 11);
            Vector2 v99 = new Vector2(v98.X + r1 / 3 + f * 2, v98.Y);
            Vector2 v100 = new Vector2(v97.X, v97.Y + r1 / 3 + f);
            Vector2 v101 = new Vector2(v100.X + r1 / 3 + f * 2, v100.Y);
            Vector2 v102 = new Vector2(v99.X, v99.Y + f * 3);
            Vector2 v103 = new Vector2(v101.X, v101.Y - f * 3);
            Vector2 v104 = new Vector2(v102.X + r1 / 3 + f, v102.Y);
            Vector2 v105 = new Vector2(v103.X + r1 / 3 + f, v103.Y);
            //
            Vector2 v106 = new Vector2(v60.X, v60.Y + f * 2.8);
            Vector2 v107 = new Vector2(v80.X, v106.Y);
            Vector2 v108 = new Vector2(v60.X, v60.Y - f * 2.8);
            Vector2 v109 = new Vector2(v80.X, v108.Y);
            //
            Vector2 v110 = new Vector2(v77.X - f * 6, v77.Y + f / 1.6);
            Vector2 v111 = new Vector2(v110.X - f * 6, v110.Y);
            Vector2 v112 = new Vector2(v77.X - f * 8, v77.Y + f * 4);
            Vector2 v113 = new Vector2(v77.X - f * 6, v77.Y + f * 4);
            Vector2 v114 = new Vector2(v77.X - f * 8, v77.Y + f * 4);
            Vector2 v115 = new Vector2(v77.X - f * 1.8, v114.Y);
            Vector2 v116 = new Vector2(v115.X - f * 1.7, v110.Y);
            Vector2 v117 = new Vector2(v115.X, v110.Y);
            Vector2 v118 = new Vector2(v77.X - f * 3.5, v1.Y - f * 4.6);
            Vector2 v119 = new Vector2(v77.X - f * 3.5, v77.Y - f * 7.5);
            // 线段
            //主视图
            Vector2[] Line1 = { v2, v4 };
            fun.drawBLine(dxf, Line1, 0.08, contour);
            Vector2[] Line2 = { v3, v5 };
            fun.drawBLine(dxf, Line2, 0.08, contour);
            Vector2[] Line3 = { v4, v5 };
            fun.drawBLine(dxf, Line3, 0.08, contour);
            Vector2[] Line4 = { v2, v6 };
            fun.drawBLine(dxf, Line4, 0.08, contour);
            Vector2[] Line5 = { v3, v7 };
            fun.drawBLine(dxf, Line5, 0.08, contour);
            Vector2[] Line6 = { v2, v8 };
            fun.drawBLine(dxf, Line6, 0.05, skdimensioning);
            Vector2[] Line7 = { v3, v9 };
            fun.drawBLine(dxf, Line7, 0.05, skdimensioning);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(v8));
            Arc1.Vertexes.Add(new LwPolylineVertex(v10));
            Arc1.Vertexes[0].Bulge = -f / 2 * Math.Tan(par / 1.3) / Math.Sin(par);
            fun.PolyFill(dxf, Arc1, 0.05, skdimensioning);
            LwPolyline Arc2 = new LwPolyline();
            Arc2.Vertexes.Add(new LwPolylineVertex(v9));
            Arc2.Vertexes.Add(new LwPolylineVertex(v11));
            Arc2.Vertexes[0].Bulge = f / 2 * Math.Tan(par / 1.3) / Math.Sin(par);
            fun.PolyFill(dxf, Arc2, 0.05, skdimensioning);
            Vector2[] Line8 = { v10, v11 };
            fun.drawBLine(dxf, Line8, 0.05, skdimensioning);
            LwPolyline Arc3 = new LwPolyline();
            Arc3.Vertexes.Add(new LwPolylineVertex(v6));
            Arc3.Vertexes.Add(new LwPolylineVertex(v12));
            Arc3.Vertexes[0].Bulge = -f / 2 * Math.Tan(par / 1.3) / Math.Sin(par);
            fun.PolyFill(dxf, Arc3, 0.08, contour);
            LwPolyline Arc4 = new LwPolyline();
            Arc4.Vertexes.Add(new LwPolylineVertex(v7));
            Arc4.Vertexes.Add(new LwPolylineVertex(v13));
            Arc4.Vertexes[0].Bulge = f / 2 * Math.Tan(par / 1.3) / Math.Sin(par);
            fun.PolyFill(dxf, Arc4, 0.08, contour);
            Vector2[] Line9 = { v15, v12 };
            fun.drawBLine(dxf, Line9, 0.08, contour);
            Vector2[] Line10 = { v13, v16 };
            fun.drawBLine(dxf, Line10, 0.08, contour);
            Vector2[] Line11 = { v15, v16 };
            fun.drawBLine(dxf, Line11, 0.08, contour);
            Vector2[] Line12 = { v15, v17 };
            fun.drawBLine(dxf, Line12, 0.1, contour);
            Vector2[] Line13 = { v16, v18 };
            fun.drawBLine(dxf, Line13, 0.1, contour);
            Vector2[] Line14 = { v17, v18 };
            fun.drawBLine(dxf, Line14, 0.1, contour);
            Vector2[] Line15 = { v17, v19 };
            fun.drawBLine(dxf, Line15, 0.1, contour);
            Vector2[] Line16 = { v18, v20 };
            fun.drawBLine(dxf, Line16, 0.1, contour);
            Vector2[] Line17 = { v19, v21 };
            fun.drawBLine(dxf, Line17, 0.1, contour);
            Vector2[] Line18 = { v20, v22 };
            fun.drawBLine(dxf, Line18, 0.1, contour);
            fun.drawPlinetype(dxf,
                new Vector2[] { new Vector2(v1.X - f * 5, v1.Y), new Vector2(v1.X + r1 * 2 + r + r1 + r1 + r, v1.Y) },
                centre, Linetype.Center);
            //
            Vector2[] Line19 = { v23, v24 };
            fun.drawBLine(dxf, Line19, 0.05, refin);
            Vector2[] Line20 = { v25, v24 };
            fun.drawBLine(dxf, Line20, 0.05, refin);
            Vector2[] Line21 = { v26, v23 };
            fun.drawBLine(dxf, Line21, 0.05, refin);
            Vector2[] Line22 = { v25, v27 };
            fun.drawBLine(dxf, Line22, 0.05, refin);
            Vector2[] Line23 = { v26, v27 };
            fun.drawBLine(dxf, Line23, 0.05, refin);
            LwPolyline Arc5 = new LwPolyline();
            Arc5.Vertexes.Add(new LwPolylineVertex(v23));
            Arc5.Vertexes.Add(new LwPolylineVertex(v25));
            Arc5.Vertexes[0].Bulge = f * Math.Tan(par / 1.2) / Math.Sin(par);
            fun.PolyFill(dxf, Arc5, 0.05, refin);
            //
            Vector2[] Line24 = { v28, v21 };
            fun.drawBLine(dxf, Line24, 0.1, contour);
            Vector2[] Line25 = { v29, v21 };
            fun.drawBLine(dxf, Line25, 0.1, contour);
            Vector2[] Line26 = { v30, v28 };
            fun.drawBLine(dxf, Line26, 0.1, contour);
            Vector2[] Line27 = { v31, v32 };
            fun.drawBLine(dxf, Line27, 0.1, contour);
            //
            Vector2[] Line28 = { v28, v34 };
            fun.drawBLine(dxf, Line28, 0.05, contour);
            Vector2[] Line29 = { v35, v34 };
            fun.drawBLine(dxf, Line29, 0.05, contour);
            Vector2[] Line30 = { v35, v36 };
            fun.drawBLine(dxf, Line30, 0.1, contour);
            Vector2[] Line31 = { v37, v36 };
            fun.drawBLine(dxf, Line31, 0.1, contour);
            Vector2[] Line32 = { v38, v34 };
            fun.drawBLine(dxf, Line32, 0.1, contour);
            Vector2[] Line33 = { v39, v35 };
            fun.drawBLine(dxf, Line33, 0.1, contour);
            Vector2[] Line34 = { v40, v41 };
            fun.drawBLine(dxf, Line34, 0.1, contour);
            //
            Vector2[] Line35 = { v43, v42 };
            fun.drawPlinetype(dxf, Line35, refin, Linetype.Dashed);
            Vector2[] Line36 = { v43, v44 };
            fun.drawPlinetype(dxf, Line36, refin, Linetype.Dashed);
            Vector2[] Line37 = { v43, v45 };
            fun.drawPlinetype(dxf, Line37, refin, Linetype.Dashed);
            Vector2[] Line38 = { v46, v45 };
            fun.drawPlinetype(dxf, Line38, refin, Linetype.Dashed);
            Vector2[] Line39 = { v46, v47 };
            fun.drawPlinetype(dxf, Line39, refin, Linetype.Dashed);
            Vector2[] Line40 = { v48, v47 };
            fun.drawPlinetype(dxf, Line40, refin, Linetype.Dashed);
            Vector2[] Line41 = { v48, v49 };
            fun.drawPlinetype(dxf, Line41, refin, Linetype.Dashed);
            LwPolyline Arc6 = new LwPolyline();
            Arc6.Vertexes.Add(new LwPolylineVertex(v49));
            Arc6.Vertexes.Add(new LwPolylineVertex(v50));
            Arc6.Vertexes[0].Bulge = -f / 1.2 * Math.Tan(par / 2) / Math.Sin(par);
            fun.PolyFill(dxf, Arc6, 0.01, refin);
            //
            Vector2[] Line42 = { v51, v52 };
            fun.drawPlinetype(dxf, Line42, refin, Linetype.Dashed);
            Vector2[] Line43 = { v53, v52 };
            fun.drawPlinetype(dxf, Line43, refin, Linetype.Dashed);
            Vector2[] Line44 = { v54, v52 };
            fun.drawPlinetype(dxf, Line44, refin, Linetype.Dashed);
            Vector2[] Line45 = { v54, v55 };
            fun.drawPlinetype(dxf, Line45, refin, Linetype.Dashed);
            Vector2[] Line46 = { v56, v55 };
            fun.drawPlinetype(dxf, Line46, refin, Linetype.Dashed);
            Vector2[] Line47 = { v56, v57 };
            fun.drawPlinetype(dxf, Line47, refin, Linetype.Dashed);
            Vector2[] Line48 = { v58, v57 };
            fun.drawPlinetype(dxf, Line48, refin, Linetype.Dashed);
            LwPolyline Arc7 = new LwPolyline();
            Arc7.Vertexes.Add(new LwPolylineVertex(v58));
            Arc7.Vertexes.Add(new LwPolylineVertex(v59));
            Arc7.Vertexes[0].Bulge = f / 1.2 * Math.Tan(par / 2) / Math.Sin(par);
            fun.PolyFill(dxf, Arc7, 0.01, refin);
            Vector2[] Line49 = { v59, v50 };
            fun.drawPlinetype(dxf, Line49, refin, Linetype.Dashed);
            Vector2[] Line50 = { v45, v54 };
            fun.drawPlinetype(dxf, Line50, refin, Linetype.Dashed);
            Vector2[] Line51 = { v46, v55 };
            fun.drawPlinetype(dxf, Line51, refin, Linetype.Dashed);
            LwPolyline poly = new LwPolyline();
            poly.Vertexes.Add(new LwPolylineVertex(fun.Polar(v60, 0, f * 2.8)));
            poly.Vertexes[0].Bulge = Math.Tan(Math.PI / 4);
            poly.Vertexes.Add(new LwPolylineVertex(fun.Polar(v60, Math.PI, f * 2.8)));
            poly.Vertexes[1].Bulge = Math.Tan(Math.PI / 4);
            poly.Vertexes.Add(new LwPolylineVertex(fun.Polar(v60, 0, f * 2.8)));
            fun.PolyFill(dxf, poly, 0.03, contour);
            Vector2[] Line52 = { v62, v61 };
            fun.drawPlinetype(dxf, Line52, refin, Linetype.Dashed);
            Vector2[] Line53 = { v63, v64 };
            fun.drawPlinetype(dxf, Line53, refin, Linetype.Dashed);
            Vector2[] Line54 = { v63, v65 };
            fun.drawBLine(dxf, Line54, 0.02, refin);
            Vector2[] Line55 = { v61, v66 };
            fun.drawBLine(dxf, Line55, 0.02, refin);
            Vector2[] Line56 = { v22, v67 };
            fun.drawBLine(dxf, Line56, 0.08, contour);
            Vector2[] Line57 = { v22, v68 };
            fun.drawBLine(dxf, Line57, 0.08, contour);
            Vector2[] Line58 = { v67, v69 };
            fun.drawBLine(dxf, Line58, 0.08, contour);
            Vector2[] Line59 = { v70, v67 };
            fun.drawBLine(dxf, Line59, 0.08, contour);
            Vector2[] Line60 = { v70, v71 };
            fun.drawBLine(dxf, Line60, 0.08, contour);
            Vector2[] Line61 = { v72, v71 };
            fun.drawBLine(dxf, Line61, 0.08, contour);
            //Vector2[] Line62 = { v73, v71 };
            //fun.drawBLine(dxf, Line62, 0.08, contour);
            Vector2[] Line63 = { v74, v70 };
            fun.drawBLine(dxf, Line63, 0.08, contour);
            Vector2[] Line64 = { v72, v75 };
            fun.drawBLine(dxf, Line64, 0.08, contour);
            Vector2[] Line65 = { v76, v77 };
            fun.drawBLine(dxf, Line65, 0.08, contour);
            Vector2[] Line66 = { v79, v78 };
            fun.drawBLine(dxf, Line66, 0.08, contour);
            Vector2[] Line67 = { v79, v77 };
            fun.drawBLine(dxf, Line67, 0.08, contour);
            Vector2[] Line68 = { v80, v77 };
            fun.drawBLine(dxf, Line68, 0.08, contour);
            Vector2[] Line69 = { v81, v79 };
            fun.drawBLine(dxf, Line69, 0.08, contour);
            Vector2[] Line70 = { v80, v81 };
            fun.drawBLine(dxf, Line70, 0.08, contour);
            Vector2[] Line71 = { v80, v82 };
            fun.drawBLine(dxf, Line71, 0.08, contour);
            Vector2[] Line72 = { v81, v83 };
            fun.drawBLine(dxf, Line72, 0.08, contour);
            Vector2[] Line73 = { v82, v84 };
            fun.drawBLine(dxf, Line73, 0.08, contour);
            Vector2[] Line74 = { v83, v85 };
            fun.drawBLine(dxf, Line74, 0.08, contour);
            Vector2[] Line75 = { v84, v85 };
            fun.drawBLine(dxf, Line75, 0.08, contour);
            Vector2[] Line76 = { v86, v92 };
            fun.drawBLine(dxf, Line76, 0.08, contour);
            Vector2[] Line77 = { v86, v87 };
            fun.drawBLine(dxf, Line77, 0.08, contour);
            Vector2[] Line78 = { v88, v87 };
            fun.drawBLine(dxf, Line78, 0.08, contour);
            Vector2[] Line79 = { v93, v89 };
            fun.drawBLine(dxf, Line79, 0.08, contour);
            Vector2[] Line80 = { v90, v89 };
            fun.drawBLine(dxf, Line80, 0.08, contour);
            Vector2[] Line81 = { v90, v91 };
            fun.drawBLine(dxf, Line81, 0.08, contour);
            Vector2[] Line82 = { v94, v95 };
            fun.drawBLine(dxf, Line82, 0.08, contour);
            Vector2[] Line83 = { v96, v97 };
            fun.drawBLine(dxf, Line83, 0.08, contour);
            Vector2[] Line84 = { v95, v97 };
            fun.drawBLine(dxf, Line84, 0.08, contour);
            Vector2[] Line85 = { v98, v99 };
            fun.drawBLine(dxf, Line85, 0.08, contour);
            Vector2[] Line86 = { v100, v101 };
            fun.drawBLine(dxf, Line86, 0.08, contour);
            Vector2[] Line87 = { v99, v101 };
            fun.drawBLine(dxf, Line87, 0.08, contour);
            Vector2[] Line88 = { v99, v102 };
            fun.drawBLine(dxf, Line88, 0.08, contour);
            Vector2[] Line89 = { v101, v103 };
            fun.drawBLine(dxf, Line89, 0.08, contour);
            Vector2[] Line90 = { v102, v104 };
            fun.drawBLine(dxf, Line90, 0.08, contour);
            Vector2[] Line91 = { v103, v105 };
            fun.drawBLine(dxf, Line91, 0.08, contour);
            Vector2[] Line92 = { v104, v105 };
            fun.drawBLine(dxf, Line92, 0.08, contour);
            DimensionStyle dimensionStyle = fun.CreateDimStyle();
            dimensionStyle.ArrowSize = 1;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 1.8;
            double offset = 6;
            LinearDimension dim1 = new LinearDimension(new Line(v95, v97), offset * 6, 270, dimensionStyle);
            dim1.UserText = "Φ27 ";
            dxf.AddEntity(dim1);
            LinearDimension dim2 = new LinearDimension(new Line(v92, v93), offset * 13, 270, dimensionStyle);
            dim2.UserText = "Φ60 ";
            dxf.AddEntity(dim2);
            LinearDimension dim3 = new LinearDimension(new Line(v92, v95), offset * 6, 360, dimensionStyle);
            dim3.UserText = "21 ";
            dxf.AddEntity(dim3);
            LinearDimension dim4 = new LinearDimension(new Line(v92, v28), offset * 4.3, 360, dimensionStyle);
            dim4.UserText = "60 ";
            dxf.AddEntity(dim4);
            Vector2[] Line93 = { v106, v107 };
            fun.drawPlinetype(dxf, Line93, refin, Linetype.Dashed);
            Vector2[] Line94 = { v109, v108 };
            fun.drawPlinetype(dxf, Line94, refin, Linetype.Dashed);
            Vector2[] Line95 = { v110, v111 };
            fun.drawBLine(dxf, Line95, 0.08, contour);
            LwPolyline Arc8 = new LwPolyline();
            Arc8.Vertexes.Add(new LwPolylineVertex(v111));
            Arc8.Vertexes.Add(new LwPolylineVertex(v112));
            Arc8.Vertexes[0].Bulge = -f / 1.3 * Math.Tan(par / 2.6) / Math.Sin(par);
            fun.PolyFill(dxf, Arc8, 0.08, contour);
            Vector2[] Line96 = { v113, v114 };
            fun.drawBLine(dxf, Line96, 0.08, contour);
            Vector2[] Line97 = { v115, v114 };
            fun.drawBLine(dxf, Line97, 0.08, contour);
            Vector2[] Line98 = { v117, v116 };
            fun.drawBLine(dxf, Line98, 0.08, contour);
            Vector2[] Line99 = { v118, v119 };
            fun.drawBLine(dxf, Line99, 0.08, contour);
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        public static void Figure29014_70_A2(Dictionary<string, Object> data) //ISO 13399-70图片A.2
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan }; //轮廓层
            Layer dimensioning = new Layer("dimensioning"); //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red }; //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow }; //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue }; //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue }; //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan }; //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red }; //切削层
            Layer nocutting = new Layer("nocutting"); //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning"); //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red }; //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue }; //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue }; //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan }; //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan }; //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning"); //skview尺寸线层
            //作图
            //参数
            string path = Convert.ToString(data["path"]);
            double r = 13.5;
            double pi = Math.PI;
            double r1 = 30;
            double f = 1;
            double par = 28 * pi / 180;
            //主视图
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X, v1.Y + r1);
            Vector2 v3 = new Vector2(v2.X + r1 / 3 - f * 4.2, v2.Y);
            Vector2 v4 = new Vector2(v1.X + r1 / 3 - f * 4.2, v1.Y);
            //
            Vector2 v5 = new Vector2(v3.X + f, v3.Y - f * 1.8);
            Vector2 v6 = new Vector2(v4.X + f, v4.Y + f * 1.8);
            //
            Vector2 v7 = new Vector2(v3.X, v3.Y - r1 / 2 + f * 3);
            Vector2 v8 = new Vector2(v4.X, v4.Y + r1 / 2 - f * 3);
            Vector2 v9 = new Vector2(v3.X + f, v3.Y - r1 / 2 + f * 3);
            Vector2 v10 = new Vector2(v4.X + f, v4.Y + r1 / 2 - f * 3);
            //下面三角的点
            Vector2 v11 = new Vector2(v6.X + f * 1.2, v6.Y);
            Vector2 v12 = new Vector2(v5.X + f * 1.2, v5.Y);
            //
            Vector2 v13 = new Vector2(v12.X + f, v12.Y + f * 1.8);
            Vector2 v14 = new Vector2(v11.X, v11.Y + r1 / 2 - f * 4.8);
            Vector2 v15 = new Vector2(v12.X, v12.Y - r1 / 2 + f * 4.8);
            Vector2 v16 = new Vector2(v11.X + f, v11.Y - f * 1.8);
            Vector2 v17 = new Vector2(v13.X, v13.Y - r1 / 2 + f * 3);
            Vector2 v18 = new Vector2(v16.X, v16.Y + r1 / 2 - f * 3);
            //
            Vector2 v19 = new Vector2(v13.X + f * 2, v13.Y);
            Vector2 v20 = new Vector2(v16.X + f * 2, v16.Y);
            //
            Vector2 v21 = new Vector2(v7.X - f / 4, v7.Y);
            Vector2 v22 = new Vector2(v8.X - f / 4, v8.Y);
            Vector2 v23 = new Vector2(v7.X + f * 5.2, v7.Y);
            Vector2 v24 = new Vector2(v22.X + f * 5.4, v22.Y);
            //
            Vector2 v25 = new Vector2(v19.X, v19.Y - f * 2);
            Vector2 v26 = new Vector2(v25.X + f / 1.6, v25.Y);
            Vector2 v27 = new Vector2(v20.X, v20.Y + f * 2);
            Vector2 v28 = new Vector2(v27.X + f / 1.6, v27.Y);
            Vector2 v29 = new Vector2(v26.X + r / 1.3, v26.Y);
            Vector2 v30 = new Vector2(v28.X + r / 1.3, v28.Y);
            Vector2 v31 = new Vector2(v29.X, v29.Y + f / 2);
            Vector2 v32 = new Vector2(v30.X, v30.Y - f / 2);
            Vector2 v33 = new Vector2(v31.X + f * 5, v31.Y);
            Vector2 v34 = new Vector2(v32.X + f * 5, v32.Y);
            //
            Vector2 v35 = new Vector2(v11.X - f * 2.2, v11.Y + f);
            Vector2 v36 = new Vector2(v35.X - f * 3, v35.Y);
            Vector2 v37 = new Vector2(v35.X + f, v35.Y + f * 1.5);
            Vector2 v38 = new Vector2(v37.X - f * 1.2, v37.Y);
            Vector2 v39 = new Vector2(v35.X + f, v35.Y + f);
            //
            Vector2 v40 = new Vector2(v4.X, v4.Y + f * 2.8);
            Vector2 v41 = new Vector2(v40.X, v40.Y + f * 1.6);
            Vector2 v42 = new Vector2(v41.X, v41.Y + f * 7.58);
            //
            Vector2 v43 = new Vector2(v39.X + f * 1.2, v39.Y + f / 2);
            Vector2 v44 = new Vector2(v43.X + f * 3, v43.Y);
            Vector2 v45 = new Vector2(v44.X - f, v39.Y - f);
            Vector2 v46 = new Vector2(v45.X + f, v39.Y - f);
            Vector2 v47 = new Vector2(v45.X - f, v39.Y - f);
            Vector2 v48 = new Vector2(v47.X - f, v47.Y + f);
            //
            Vector2 v49 = new Vector2(v16.X, v16.Y + f * 2.8);
            Vector2 v50 = new Vector2(v49.X, v49.Y + f * 1.6);
            Vector2 v51 = new Vector2(v50.X, v50.Y + f * 7.58);
            // 线段
            //主视图
            Vector2[] Line1 = { v1, v2 };
            fun.drawBLine(dxf, Line1, 0.08, contour);
            Vector2[] Line2 = { v3, v2 };
            fun.drawBLine(dxf, Line2, 0.08, contour);
            Vector2[] Line3 = { v1, v4 };
            fun.drawBLine(dxf, Line3, 0.08, contour);
            Vector2[] Line4 = { v3, v7 };
            fun.drawBLine(dxf, Line4, 0.08, contour);
            //Vector2[] Line5 = { v4, v8 };
            //fun.drawBLine(dxf, Line5, 0.08, contour);
            Vector2[] Line6 = { v3, v5 };
            fun.drawBLine(dxf, Line6, 0.08, contour);
            Vector2[] Line7 = { v5, v9 };
            fun.drawBLine(dxf, Line7, 0.08, contour);
            Vector2[] Line8 = { v4, v6 };
            fun.drawBLine(dxf, Line8, 0.08, contour);
            Vector2[] Line9 = { v6, v10 };
            fun.drawBLine(dxf, Line9, 0.08, contour);
            Vector2[] Line10 = { v6, v11 };
            fun.drawBLine(dxf, Line10, 0.08, contour);
            Vector2[] Line11 = { v5, v12 };
            fun.drawBLine(dxf, Line11, 0.08, contour);
            Vector2[] Line12 = { v13, v12 };
            fun.drawBLine(dxf, Line12, 0.08, contour);
            Vector2[] Line13 = { v14, v11 };
            fun.drawBLine(dxf, Line13, 0.08, contour);
            Vector2[] Line14 = { v15, v12 };
            fun.drawBLine(dxf, Line14, 0.08, contour);
            Vector2[] Line15 = { v16, v11 };
            fun.drawBLine(dxf, Line15, 0.08, contour);
            Vector2[] Line16 = { v17, v13 };
            fun.drawBLine(dxf, Line16, 0.08, contour);
            //Vector2[] Line17 = { v18, v16 };
            // fun.drawBLine(dxf, Line17, 0.08, contour);
            Vector2[] Line18 = { v13, v19 };
            fun.drawBLine(dxf, Line18, 0.08, contour);
            Vector2[] Line19 = { v16, v20 };
            fun.drawBLine(dxf, Line19, 0.08, contour);
            Vector2[] Line20 = { v19, v20 };
            fun.drawBLine(dxf, Line20, 0.08, contour);
            Vector2[] Line21 = { v7, v21 };
            fun.drawBLine(dxf, Line21, 0.08, contour);
            Vector2[] Line22 = { v8, v22 };
            fun.drawBLine(dxf, Line22, 0.08, contour);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(v21));
            Arc1.Vertexes.Add(new LwPolylineVertex(v22));
            Arc1.Vertexes[0].Bulge = f * Math.Tan(par / 1.1) / Math.Sin(par);
            fun.PolyFill(dxf, Arc1, 0.08, contour);
            Vector2[] Line23 = { v23, v21 };
            fun.drawBLine(dxf, Line23, 0.08, contour);
            Vector2[] Line24 = { v24, v22 };
            fun.drawBLine(dxf, Line24, 0.08, contour);
            Vector2[] Line25 = { v26, v25 };
            fun.drawBLine(dxf, Line25, 0.08, contour);
            Vector2[] Line26 = { v27, v28 };
            fun.drawBLine(dxf, Line26, 0.08, contour);
            Vector2[] Line27 = { v26, v28 };
            fun.drawBLine(dxf, Line27, 0.08, contour);
            Vector2[] Line28 = { v26, v29 };
            fun.drawBLine(dxf, Line28, 0.08, contour);
            Vector2[] Line29 = { v30, v28 };
            fun.drawBLine(dxf, Line29, 0.08, contour);
            Vector2[] Line30 = { v30, v29 };
            fun.drawBLine(dxf, Line30, 0.08, contour);
            Vector2[] Line31 = { v31, v29 };
            fun.drawBLine(dxf, Line31, 0.08, contour);
            Vector2[] Line32 = { v32, v30 };
            fun.drawBLine(dxf, Line32, 0.08, contour);
            Vector2[] Line33 = { v33, v31 };
            fun.drawBLine(dxf, Line33, 0.08, contour);
            Vector2[] Line34 = { v34, v32 };
            fun.drawBLine(dxf, Line34, 0.08, contour);
            Vector2[] Line35 = { v34, v33 };
            fun.drawBLine(dxf, Line35, 0.08, contour);
            Vector2[] Line36 = { v36, v35 };
            fun.drawBLine(dxf, Line36, 0.08, contour);
            Vector2[] Line37 = { v37, v38 };
            fun.drawBLine(dxf, Line37, 0.08, contour);
            LwPolyline Arc2 = new LwPolyline();
            Arc2.Vertexes.Add(new LwPolylineVertex(v36));
            Arc2.Vertexes.Add(new LwPolylineVertex(v38));
            Arc2.Vertexes[0].Bulge = -f / 1.25 * Math.Tan(par / 3) / Math.Sin(par);
            fun.PolyFill(dxf, Arc2, 0.08, contour);
            Vector2[] Line38 = { v35, v39 };
            fun.drawBLine(dxf, Line38, 0.08, contour);
            Vector2[] Line39 = { v4, v40 };
            fun.drawBLine(dxf, Line39, 0.08, contour);
            Vector2[] Line40 = { v41, v42 };
            fun.drawBLine(dxf, Line40, 0.08, contour);
            Vector2[] Line41 = { v43, v44 };
            fun.drawBLine(dxf, Line41, 0.08, contour);
            Vector2[] Line42 = { v45, v46 };
            fun.drawBLine(dxf, Line42, 0.08, contour);
            Vector2[] Line43 = { v47, v46 };
            fun.drawBLine(dxf, Line43, 0.08, contour);
            Vector2[] Line44 = { v47, v48 };
            fun.drawBLine(dxf, Line44, 0.08, contour);
            Vector2[] Line45 = { v16, v49 };
            fun.drawBLine(dxf, Line45, 0.08, contour);
            Vector2[] Line46 = { v50, v51 };
            fun.drawBLine(dxf, Line46, 0.08, contour);
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}